﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace blackhouse.Translator.Business.Configuration {

    [ConfigurationCollection(typeof(TranslatorConfigurationLanguageElement), AddItemName = "Language", CollectionType = ConfigurationElementCollectionType.BasicMap)]
    internal class TranslatorConfigurationLanguageCollection : ConfigurationElementCollection {

        #region Properties

        protected override string ElementName {
            get {
                return "Language";
            }
        }

        #endregion

        #region Methods

        protected override bool IsElementName(string elementName) {
            return (elementName == "Language");
        }

        protected override object GetElementKey(ConfigurationElement element) {
            return ((TranslatorConfigurationLanguageElement)element).Culture;
        }

        protected override ConfigurationElement CreateNewElement() {
            return new TranslatorConfigurationLanguageElement();
        }

        new public TranslatorConfigurationLanguageElement this[string culture] {
            get { return (TranslatorConfigurationLanguageElement)base.BaseGet(culture); }
        }

        public override bool IsReadOnly() {
            return false;
        }

        #endregion

    }
}
